#ifndef __CAN_RECEIVE_H__
#define __CAN_RECEIVE_H__

#include "struct_typedef.h"
#include "bsp_can.h"

//=====================================================================================================

/*-----------------selections
--------------------------------------------------------
@brief:
*/


/*-----------------settings
--------------------------------------------------------
@brief:
*/
extern CAN_HandleTypeDef hcan1;
extern CAN_HandleTypeDef hcan2;

#define CHASSIS_CAN hcan1
#define GIMBAL_CAN hcan2

/*-----------------definitions
--------------------------------------------------------
@brief:
*/

//=====================================================================================================

/*-----------------params
--------------------------------------------------------
@brief:
*/
//can发送和接收id
typedef enum can_msg_id
{
    CAN_CHASSIS_ALL_ID = 0x200,
    CAN_3508_M1_ID = 0x201,
    CAN_3508_M2_ID = 0x202,
    CAN_3508_M3_ID = 0x203,
    CAN_3508_M4_ID = 0x204,

    CAN_YAW_MOTOR_ID = 0x205,
    CAN_PIT_MOTOR_ID = 0x206,
    CAN_TRIGGER_MOTOR_ID = 0x207,
    CAN_GIMBAL_ALL_ID = 0x1FF,

} can_msg_id_e;

//电机数据
typedef struct motor_measure
{
    uint16_t ecd;
    int16_t speed_rpm;
    int16_t given_current;
    uint8_t temperate;
    int16_t last_ecd;
} motor_measure_t;
/*-----------------functions
--------------------------------------------------------
@brief:
*/
//
void CAN_cmd_chassis(int16_t motor1, int16_t motor2, int16_t motor3, int16_t motor4);
//
void CAN_cmd_gimbal(int16_t yaw, int16_t pitch, int16_t shoot, int16_t rev);
//
void CAN_cmd_chassis_reset_ID(void);
//
const motor_measure_t *p_get_yaw_motor_point(void);
//
const motor_measure_t *p_get_pitch_motor_point(void);
//
const motor_measure_t *p_get_trigger_motor_point(void);
// 
const motor_measure_t *p_get_chassis_motor_point(uint8_t i);
/*-----------------XXX API_h
--------------------------------------------------------
@brief:
*/
//

/*------------------------end-------------------------*/
#endif